home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12595 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is This Bad Coding Practice?
  5. Date: Mon, 01 Apr 96 21:51:03 GMT
  6. Organization: none
  7. Message-ID: <828395463snz@genesis.demon.co.uk>
  8. References: <4jgnt2$9d1@loki.tor.hookup.net> <828135115snz@genesis.demon.co.uk> <4jjqf1$6c1@loki.tor.hookup.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4jjqf1$6c1@loki.tor.hookup.net>
  15.            Rajendra_Singh@msn.com "Rajendra Singh" writes:
  16.  
  17. >Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
  18. >
  19. >>No, as soon as func1 returns test doesn't exist any more so you cannot
  20. >>safely access it (doing so results in undefined behaviour). Don't
  21. >>do it, even if it seems to work on your system - it will bite you, sooner
  22. >>rather than later if you're lucky.
  23. >
  24. >I was working with a company and one of the senior programmers had
  25. >this piece of code in production.  When I questioned him about it, he
  26. >says that it will always work.
  27.  
  28. I'd be worried if this was his general attitude towards software development,
  29. especially in production code.
  30.  
  31. > I had my doubts, that's why I was
  32. >curious as to whether or not it would always work.
  33.  
  34. In a real sense it doesn't matter whether any implementations exist where
  35. that particular piece of code fails. The code is a maintenance nightmare
  36. because it doesn't mean anything - it has no well defined bevahiour. If
  37. you're trying to debug code with such things liberally sprinked through it
  38. any one of them could be the cause of trouble, it makes the whole process
  39. much more difficult.
  40.  
  41. >By the way, the forementioned piece of code worked on AIX, SCO, HPUX,
  42. >and OS/2.
  43.  
  44. I assume that the code to test this was different since that posted doesn't
  45. output any verifyable results.
  46.  
  47. -- 
  48. -----------------------------------------
  49. Lawrence Kirby | fred@genesis.demon.co.uk
  50. Wilts, England | 70734.126@compuserve.com
  51. -----------------------------------------
  52.